import { request } from 'umi';

/** 获取用户列表 */
export async function getUserList(params: SYSTEMUSER.UserParams, options?: Record<string, any>) {
  return request<Record<string, any>>('/api/userList', {
    params,
    method: 'GET',
    ...(options || {}),
  });
}
/** 获取用户信息 */
export async function getUserInfo(
  params: SYSTEMUSER.UserInfoParams,
  options?: Record<string, any>,
) {
  return request<Record<string, any>>('/api/user', {
    params,
    method: 'GET',
    ...(options || {}),
  });
}

/** 添加用户 */
export async function addUser(data: SYSTEMUSER.AddRoleParams, options?: Record<string, any>) {
  return request<Record<string, any>>('/api/user', {
    data,
    method: 'POST',
    ...(options || {}),
  });
}

/** 编辑用户 */
export async function editUser(data: SYSTEMUSER.EditRoleParams, options?: Record<string, any>) {
  return request<Record<string, any>>('/api/user', {
    data,
    method: 'PUT',
    ...(options || {}),
  });
}
/** 删除用户 */
export async function deleteUser(
  params: Pick<SYSTEMUSER.UserType, 'id'>,
  options?: Record<string, any>,
) {
  return request<Record<string, any>>('/api/user', {
    params,
    method: 'DELETE',
    ...(options || {}),
  });
}
